package org.zuel.boot.demo.controller;

import org.zuel.boot.demo.entity.StudentSign;
import org.zuel.boot.demo.service.IStudentSignService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.zuel.boot.demo.web.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;

/**
 *  控制器
 *
 * @author ikun
 */
@Api(tags = "管理")
@RestController
@RequestMapping("/zuel")
public class StudentSignController{

    private IStudentSignService studentSignService;

    @Autowired
    public StudentSignController(IStudentSignService studentSignService){
        this.studentSignService = studentSignService;
    }

    @ApiOperation("查询列表")
    @GetMapping("/studentSign/list")
    public PageResult<StudentSign> list(HttpServletRequest request) {
        PageParam<StudentSign> pageParam = new PageParam<>(request);
        return studentSignService.list(pageParam);
    }

    @ApiOperation("查询单个")
    @GetMapping("/studentSign/get/{id}")
    public JsonResult read(@PathVariable("id") Integer id) {
        return studentSignService.read(id);
    }

    @ApiOperation("添加")
    @PostMapping("/studentSign/add")
    public JsonResult add(@RequestBody StudentSign model) {
    return studentSignService.add(model);
    }

    @ApiOperation("修改")
    @PostMapping("/studentSign/update")
    public JsonResult update(@RequestBody StudentSign model) {
    return studentSignService.update(model);
    }

    @ApiOperation("删除")
    @GetMapping("/studentSign/delete/{ids}")
    public JsonResult delete(@PathVariable("ids") Integer[] ids) {
        return studentSignService.delete(ids);
    }

}